#include <QtCore/QCoreApplication>
#include "./dailytimertest.h"
#include "./weeklytimertest.h"
#include <iostream>
using namespace std;

int testDailyTimer();
int testWeeklyTimer();

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    int retval = 0;

    retval = testDailyTimer();
    retval = testWeeklyTimer();

    a.exit();
    return retval;
}

int testDailyTimer()
{
    int retval = 0;
    DailyTimerTest* dtt = new DailyTimerTest();

    cout << "Testing QDailyTimer..." << endl;
    if (dtt->rescheduleTimer() == true)
	    {
	        cout << "1. rescheduleTimer() test passed." << endl;
	    } else {
	        cout << "1. rescheduleTimer() test failed." << endl;
	        retval = -1;
    }

    if (dtt->paramTimeIsInThePast() == true)
    {
        cout << "1. paramTimeIsInThePast() test passed." << endl;
    } else {
        cout << "1. paramTimeIsInThePast() test failed." << endl;
        retval = -1;
    }

    if (dtt->paramTimeIsInTheFuture() == true)
    {
        cout << "2. paramTimeIsInTheFuture() test passed." << endl;
    } else {
        cout << "2. paramTimeIsInTheFuture() test failed." << endl;
        retval = -1;
    }
    cout << endl;

    return retval;
}

int testWeeklyTimer()
{
    int retval = 0;
    WeeklyTimerTest* wtt = new WeeklyTimerTest();

    cout << "Testing QWeeklyTimer..." << endl;
    if (wtt->paramDayIsInThePast() == true)
    {
        cout << "1. paramDayIsInThePast() test passed." << endl;
    } else {
        cout << "1. paramDayIsInThePast() test failed." << endl;
        retval = -1;
    }

    if (wtt->paramDayIsTodayInThePast() == true)
    {
        cout << "2. paramDayIsTodayInThePast() test passed." << endl;
    } else {
        cout << "2. paramDayIsTodayInThePast() test failed." << endl;
        retval = -1;
    }

    if (wtt->paramDayIsTodayInTheFuture() == true)
    {
        cout << "3. paramDayIsTodayInTheFuture() test passed." << endl;
    } else {
        cout << "3. paramDayIsTodayInTheFuture() test failed." << endl;
        retval = -1;
    }

    if (wtt->paramDayIsInTheFuture() == true)
    {
        cout << "4. paramDayIsInTheFuture() test passed." << endl;
    } else {
        cout << "4. paramDayIsInTheFuture() test failed." << endl;
        retval = -1;
    }
    cout << endl;

    return retval;
}
